package com.hhf.cloud.controller;

import com.hhf.cloud.resp.Result;
import com.hhf.cloud.service.AccountTccService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Daniel-黄海峰
 * @Description
 * @create 2024/3/2 22:00
 * TCC模式
 */
@RestController
public class AccountTccController {
    @Autowired
    private AccountTccService accountTCCService;

    /**
     * 扣减账户余额TCC
     */
    @PostMapping("account/decreasetcc")
    Result<String> decreaseTcc(@RequestParam("userId") Long userId,
                               @RequestParam("money") Long money) {
        accountTCCService.decreaseTcc(null, userId, money);
        return Result.success("tcc扣减账户余额成功！");
    }
}
